package com.app.controller;

import com.app.commons.dto.Dto;
import com.app.commons.pojo.UserInfo;
import com.app.commons.utils.DtoUtil;
import com.app.commons.utils.Page;
import com.app.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class HomeController {
    @Autowired
    private UserService userService;

    @GetMapping("/index")
    public Dto<Page<UserInfo>> index(
            @RequestParam(value = "pageIndex",defaultValue = "1") int pageIndex, int pageSize){
        Page<UserInfo> page = userService.getPage(pageIndex,pageSize);
        Dto dto = DtoUtil.returnSuccess("哈哈哈",page);
        return dto;
    }
}
